package cn.hquanheng.java_base.day5Test;

public class SumDigits {

	public static void main(String[] args) {
		System.out.println(sumDigits(1234));
	}
	  public static int sumDigits (long n) {
		  int sum=0;
		  while(n!=0) {
			  sum+=(n%10);
			  n/=10;
		  }
		  return sum;
	  }
}
